package com.zidian.leader.adapter;

import android.content.Context;
import android.support.annotation.StringDef;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.zidian.leader.R;
import com.zidian.leader.api.Constant;
import com.zidian.leader.fragment.ColleagueEvaFragment;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * 同行/督导评价pagerAdapter
 * Created by GongCheng on 2017/1/12.
 */

public class ColleagueEvaPagerAdapter extends FragmentPagerAdapter {
    private String collegeName;
    private Context context;

    @StringDef({
            StatisticsType.SUPERVISOR_EVALUATE,
            StatisticsType.COLLEAGUE_EVALUATE
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface StatisticsType {
        String SUPERVISOR_EVALUATE = "supervisorEvaluate";
        String COLLEAGUE_EVALUATE = "colleagueEvaluate";
    }

    public ColleagueEvaPagerAdapter(FragmentManager fm, Context context, String collegeName) {
        super(fm);
        this.collegeName = collegeName;
        this.context = context;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                return ColleagueEvaFragment.newInstance(StatisticsType.SUPERVISOR_EVALUATE, collegeName);
            case 1:
                return ColleagueEvaFragment.newInstance(StatisticsType.COLLEAGUE_EVALUATE, collegeName);
            default:
                return ColleagueEvaFragment.newInstance(StatisticsType.SUPERVISOR_EVALUATE, collegeName);
        }
    }

    @Override
    public int getCount() {
        return 2;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        switch (position) {
            case 0:
                return context.getString(R.string.supervisor_evaluation);
            case 1:
                return context.getString(R.string.colleague_evaluation);
            default:
                return context.getString(R.string.supervisor_evaluation);
        }
    }
}
